package chapter_7;

import java.io.*;

public class Test17 {
    public static void main(String[] args) throws Exception {
        FileOutputStream fos = new FileOutputStream("D:\\data.dat");
        DataOutputStream dos = new DataOutputStream(fos);
        dos.writeInt(98);
        dos.writeDouble(10.78);
        dos.writeBoolean(true);
        dos.writeUTF("你好");
        dos.close();

        FileInputStream fis = new FileInputStream("D:\\data.dat");
        DataInputStream dis = new DataInputStream(fis);
        System.out.println(dis.readInt());
        System.out.println(dis.readDouble());
        System.out.println(dis.readBoolean());
        System.out.println(dis.readUTF());
        dis.close();
    }
}
